#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/proc_fs.h>
#include <linux/list.h>
#include <asm/uaccess.h>
#include <linux/udp.h>
#include <linux/tcp.h>
#include <linux/skbuff.h>
#include <linux/ip.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv4.h>
#include "Definitii.h"

/* rutina de initializare */
struct file_operations proc_fops = 
{
		read: procf_read,
		write: procf_write
};

void create_new_proc_entry(void) 
{
	proc_create(PROCF_NAME,0,NULL,&proc_fops);
}

int proc_init(void) 
{
    printk(KERN_INFO "initializeaza modul kernel\n");
    procf_buffer = (char *) vmalloc(PROCF_MAX_SIZE);
    INIT_LIST_HEAD(&(regula.list));
	create_new_proc_entry();
    printk(KERN_INFO "/proc/%s is created\n", PROCF_NAME);
    nfho.hook = hook_func_in;
    nfho.hooknum = NF_INET_LOCAL_IN;
    nfho.pf = PF_INET;
    nfho.priority = NF_IP_PRI_FIRST;
    nf_register_hook(&nfho);        
    nfho_out.hook = hook_func_out;
    nfho_out.hooknum = NF_INET_LOCAL_OUT;
    nfho_out.pf = PF_INET;
    nfho_out.priority = NF_IP_PRI_FIRST;
    nf_register_hook(&nfho_out);  
    return 0;
}
